home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
amok_lha
/
amok82.lha
/
Printf1.4
/
Printf.mod
< prev
next >
Wrap
Text File
|
1993-08-15
|
3KB
|
94 lines
(*
:Program. Printf
:Author. Volker Rudolph, hartmut Goebel [hG]
:Address. Lettow-Vorbeck-Str. 11 / 6750 Kaiserslautern
:Phone. 06301/8566
:Date. 22 Aug 1992 21:04:06
:Copyright. PD
:Language. Assembler / Oberon
:Translator. A68k / Amiga-Oberon V2.45
:History. V1.3 14 Nov 1991 [hG] LONGINT -> s.ADDRESS
:History. V1.4 27 Aug 1992 [hG] angepasst an AO 3.0
:Contents. Allzweck-Textausgabe in Form der C-Funktion Printf
:Usage. Aufruf und Parameter wie in C
*)
MODULE Printf;
IMPORT d:Dos, s: SYSTEM;
(* $JOIN obj/printf.o $JOIN obj/sprintf.o *)
CONST
(* Größe des Ausgabepuffers *)
(* Der Ausgabestring darf nicht länger sein *)
bufSize * = 120;
TYPE
(* Man kann jede Funktion dieses Typs als Ausgabeprozedur angeben *)
WriteProcType * = PROCEDURE(str:ARRAY OF CHAR);
VAR
(* Ausgabeprozedur *)
writeProc * :WriteProcType;
(* --------------------------------------------------------------- *)
PROCEDURE Printf0*{"Printf.Printf0"}(str:ARRAY OF CHAR);
PROCEDURE Printf1*{"Printf.Printf1"}(str:ARRAY OF CHAR;val1:s.ADDRESS);
PROCEDURE Printf2*{"Printf.Printf2"}(str:ARRAY OF CHAR;val1,val2:s.ADDRESS);
PROCEDURE Printf3*{"Printf.Printf3"}(str:ARRAY OF CHAR;val1,val2,val3:s.ADDRESS);
PROCEDURE Printf4*{"Printf.Printf4"}(str:ARRAY OF CHAR;val1,val2,val3,val4:s.ADDRESS);
PROCEDURE Printf5*{"Printf.Printf5"}(str:ARRAY OF CHAR;val1,val2,val3,val4,val5:s.ADDRESS);
PROCEDURE Printf6*{"Printf.Printf6"}(str:ARRAY OF CHAR;val1,val2,val3,val4,val5,val6:s.ADDRESS);
PROCEDURE SPrintf0 * {"Printf.SPrintf0"}
(VAR buf:ARRAY OF CHAR;str:ARRAY OF CHAR);
PROCEDURE SPrintf1 * {"Printf.SPrintf1"}
(VAR buf:ARRAY OF CHAR;str:ARRAY OF CHAR;val1:s.ADDRESS);
PROCEDURE SPrintf2 * {"Printf.SPrintf2"}
(VAR buf:ARRAY OF CHAR;str:ARRAY OF CHAR;val1,val2:s.ADDRESS);
PROCEDURE SPrintf3 * {"Printf.SPrintf3"}
(VAR buf:ARRAY OF CHAR;str:ARRAY OF CHAR;val1,val2,val3:s.ADDRESS);
PROCEDURE SPrintf4 * {"Printf.SPrintf4"}
(VAR buf:ARRAY OF CHAR;str:ARRAY OF CHAR;val1,val2,val3,val4:s.ADDRESS);
PROCEDURE SPrintf5 * {"Printf.SPrintf5"}
(VAR buf:ARRAY OF CHAR;str:ARRAY OF CHAR;val1,val2,val3,val4,val5:s.ADDRESS);
PROCEDURE SPrintf6 * {"Printf.SPrintf6"}
(VAR buf:ARRAY OF CHAR;str:ARRAY OF CHAR;val1,val2,val3,val4,val5,val6:s.ADDRESS);
(* ---------------------------------------------------------------- *)
(* $RangeChk- $OvflChk- $NilChk- $CopyArrays- *)
PROCEDURE WriteString*(str:ARRAY OF CHAR);
VAR
i:LONGINT;
out:d.FileHandlePtr;
BEGIN
i := 0;
WHILE (i < LEN(str)) AND (str[i] # 0X) DO INC(i) END;
out := d.Output();
IF (out = NIL) OR
(d.Write(out,str,i) # i) THEN
HALT(20)
END; (* END *)
END WriteString;
PROCEDURE WriteLn*;
BEGIN
writeProc("\n");
END WriteLn;
(* Hilfs-Prozedur, die von den Assembler-Routinen aufgerufen wird *)
(* $CopyArrays- *)
PROCEDURE WriteProc*(str:ARRAY OF CHAR);
BEGIN
writeProc(str);
END WriteProc;
(* ---------------------------------------------------------------- *)
BEGIN
writeProc := WriteString;
END Printf.